#! /usr/bin/env python 
#coding=utf-8
from model import user as um

from collections import namedtuple
from util import json_util





def get_users():
    return json_util.to_json(um.User.resource_fields,um.get_users())

def add_user(u):
    #print(u['id'])
    # User=namedtuple("User",['id','username','password'])
    # user=User(**u)
    u['id']=15
    user_object=um.User(u)
    return json_util.to_sucess(u,um.add_user(user_object))